/**
 * Copyright 2007 Luke Pillow
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.orsomethinglikethat.hinge.asgen.meta;

import java.util.ArrayList;
import java.util.List;

import org.apache.log4j.Logger;

/**
 * @author lpillow
 */
public class MetaClass
{
    private static final Logger log = Logger.getLogger( MetaClass.class );

    private String packageName;
    private String name;

    private MetaClass superclass;
    private List<MetaField> fields = new ArrayList<MetaField>();

    public MetaClass( String name, String packageName )
    {
        super();
        this.setName( name );
        this.setPackageName( packageName );
        log.debug( "Constructing MetaClass: " + this.qualifiedName() );
    }

    public String qualifiedName()
    {
        return ( this.getPackageName() == null ? "" : this.getPackageName() ) + "." + this.getName();
    }

    public void addField( MetaField field )
    {
        this.getFields().add( field );
    }

    /**
     * @return the name
     */
    public String getName()
    {
        return name;
    }

    /**
     * @param name
     *            the name to set
     */
    public void setName( String name )
    {
        this.name = name;
    }

    /**
     * @return the packageName
     */
    public String getPackageName()
    {
        return packageName;
    }

    /**
     * @param packageName
     *            the packageName to set
     */
    public void setPackageName( String packageName )
    {
        this.packageName = packageName;
    }

    /**
     * @return the superclass
     */
    public MetaClass getSuperclass()
    {
        return superclass;
    }

    /**
     * @param superclass
     *            the superclass to set
     */
    public void setSuperclass( MetaClass superclass )
    {
        this.superclass = superclass;
    }

    /**
     * @return the fields
     */
    public List<MetaField> getFields()
    {
        return fields;
    }

    /**
     * @param fields
     *            the fields to set
     */
    public void setFields( List<MetaField> fields )
    {
        this.fields = fields;
    }

}
